<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="layout::head('图书管理')">
    <style th:inline="text">
        body{
            background: url("[[@{/}]]img/1.jpg");
        }
        /*th:include="layout::head('图书管理')"*/
    </style>
    <meta charset="UTF-8">
    <title>111用户列表</title>
</head>
<body >
<div th:replace="~{layout::header}"></div>
<div class="container" style="margin-left:400px">

    <h2>图书列表</h2>
    </br>
    <a  href="/book/add" th:action="@{/book/add}" style="font-size: 40px">添加图书 </a>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
        <a  href="/category/list" style="font-size: 40px" >前往类别管理</a> </br></br></br>


    <form  th:action="@{/book/find}" method="post">
        <a>根据图书名称查询</a>      <input type="text"  name="bookname" >  <input type="submit" value="搜索" />  <input type="reset" value="重填" />
    </form>
    <form th:action="@{/book/findpublish}" method="post">
        <a>根据出版社查询&ensp;&ensp;</a>       <input type="text"  name="pubname" >  <input type="submit" value="搜索" />  <input type="reset" value="重填" />
    </form>
    <form th:action="@{/book/findcategory}" method="post">
        <a>根据图书类别查询</a>     <input type="text"  name="category" >  <input type="submit" value="搜索" />  <input type="reset" value="重填" />
    </form>
    </br></br>


        <table class="table table-hover" border="1" width="1000">
            <tr>
                <th>图书 id</th> <th>图书名</th>  <th>图书 ISBN 号</th>  <th>作者</th> <th>出版社</th> <th>价格</th><th>类别</th>  <th>操作</th> <th>操作</th>
            </tr>

            <tr th:each="book : ${bookPage.getContent()}">
                <th scope="row" th:text="${book.getId()}">id未知</th>
                <td th:text="${book.getName()}">名称未知</td>
                <td th:text="${book.getIsbn()}">isbn未知</td>
                <td th:text="${book.getAuthor()}">作者未知</td>
                <td th:text="${book.getPublish()}">出版社未知</td>
                <td th:text="${book.getPrice()}">价格未知</td>
                <td th:text="${book.getCategory().getName()}">类别未知</td>
                <td><a th:href="@{/book/edit/{id}(id=${book.getId()})}">编辑</a></td>
                <td><a th:href="@{/book/delete/{id}(id=${book.getId()})}">删除</a></td>
            </tr>
        </table>

    </br>
    <div>
        当前第<span th:text="${bookPage.getNumber()} + 1"></span>页 / 总<span th:text="${bookPage.getTotalPages()}"></span>页 共<span th:text="${bookPage.getTotalElements()}"></span>条记录
        <a class="btn btn-info" th:href="@{/book/list(page=1,size=${size})}">首页</a>
        <a class="btn btn-info" th:href="@{/book/list(page = ${bookPage.hasPrevious()} ? ${bookPage.getNumber()} : 1,size=${size})}">上一页</a>
        <a class="btn btn-info" th:href="@{/book/list(page = ${bookPage.hasNext()} ? ${bookPage.getNumber()} + 2 : ${bookPage.getTotalPages()},size=${size})}">下一页</a>
        <a class="btn btn-info" th:href="@{/book/list(page = ${bookPage.getTotalPages()},size=${size})}">尾页</a>

    </div>
</div>
</body>
</html>